
CHL File Format
----------------

******************************************************************************
   WARNING: 
	In v1.5g , number of channels that CHL file can hold is now unlimited.
	Please refer to older ModuleAPI SDKs
	And the file format will change a bit in DD v1.6 due to lack of 
	the space to store unicode channel names
******************************************************************************

	
  A CHL file has a an expandable file size as it can hold unlimited number 
of channels

File consist of following 4 sections:

Offset     Section
--------   -----------
00000000 : Header  (26 bytes)
0000001A : Satellites (8320 bytes)
0000209A : Favorites (5120 bytes)
0000349A : Channels  (unlimited)


Max number of items that CHL file can hold are below
- Satellites: 64
- Favorites: 64
- Channels: unlimited
- Audio PIDs per channel: 16
- CA PIDs per channel: 64



Detailed info about the sections can be found in header files for the 
following compilers

C/C++ = moduleapi.h
Delphi = moduleapi.pas


* chbase.pas includes CHL helper functions for Delphi.



NOTES:
1) If dwFreq (in the TChlChannel) is 0, 
     wPos (in the TChlSat) is 0,
     FavName (in the TChlFav) is 0
     it means that entry in the array is not used (or is empty)
2) Favorites stored as "favid+1" in TChlChannel structure
3) In an empty CHL all the bytes must be 0, except the header section as 
it holds the sign and version info
4) Following line shows how Channel-ID that is used in ModuleAPI functions
 is calculated: 
	CHID = Offset(in the array) / sizeof(TChlChannel)
5) Following line shows how Fav-ID is calculated: 
	FAVID = Offset(in the array) / sizeof(TChlFav)
6) Satellite position info stored in SatCoDX 4 digit sat-code format 
  (19.2 East = 0192   or   110  West = 2500)
  West positions calculated as 360 - angle





How to use new unlimited channels feature in the modules:
-------------------------------------------------------------
(for DVB Dream v1.6 and above)

Delphi:

var
  chl: PCHL;
  chl_channels: PChlArray; // pointer for dynamic array access
  MAX_CHANNELS : Integer = 8000; // just the default
begin
  //Get internal channel list pointer of DD
  MAX_CHANNELS := SendMessage(hwndDD, WM_MODULE_MSG, DDMODAPI_CHL_GET_POINTER, Integer(@chl));
  chl_channels := pointer(int64(Chl) + sizeof(TCHL));
  ...
end;





c++

TCHL *chl;
TChlChannel *chl_Channels;
int MAX_CHANNELS = 8000;  // just the default

   MAX_CHANNELS = SendMessage(hDDwnd, WM_MODULE_MSG, DDMODAPI_CHL_GET_POINTER, (long) ppCHL);
   chl_Channels = (TChlChannel *)(chl + sizeof(TCHL)); 
   ...



You can ask for more information in the www.dvbdream.org forums

